#include "quesion35.h"
#include <string>
#include <sstream>
#include <iostream>

int quesion35::searchInsert(vector<int>& nums, int target)
{
    if(nums[0]>target) return 0;
    else if(nums[nums.size()-1]<target) return nums.size();
    else{
        for(int i=0;i<nums.size();i++){
            if(nums[i]==target) return i;
            else if(nums[i]<target&&target<nums[i+1]) return i+1;
            else continue;
        }
    }
    return 0;//don't care
}
